package day05.homework;
//利用for循环计算：求8的阶乘，并输出
public class Answer2 {
    public static void main(String[] args) {
        int num=8;
        int sum=getFactorial(num);
        System.out.println(sum);
    }

    private static int getFactorial(int num) {
        int result=1;
        for (int i = 1; i <=num ; i++) {
            result*=i;
        }
        return result;
    }
}
